<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../templates/StakeholderPortalTemplate.xhtml">
    <link href="./../resources/css/default.css" rel="stylesheet" type="text/css" />
    <link href="./../resources/css/tableLayout.css" rel="stylesheet" type="text/css" />
    <ui:define name="left">
        <table>
            <tr>
                <td><a id="addBranchLink" href="AddBranch.xhtml"><font color="#43C6DB">#{bundle['index.addbranch.link']}</font></a></td>
            </tr>
            <tr>
                <td><a id="viewBranchLink" href="ViewAllBranch.xhtml"><font color="#43C6DB">#{bundle['index.viewallbranch.link']}</font></a></td>
            </tr>
        </table>
    </ui:define>
    <ui:define name="content">
       <h:form id="viewAllBranchesForm">
            <p:panel id="viewAllBranchesPanel" header="#{bundle['branch.viewallbranches.panel']}">
                <p:messages id="statusMessages" />
                
                <p:dataTable var="localizedState" value="#{viewBranchManagedBean.branchList}" emptyMessage="No branches found">  
                    
                    <f:facet name="header">  
                        <p:outputPanel>  
                            <h:outputText value="Search all fields: " />  
                            <p:inputText id="globalFilter" onkeyup="viewBranchManagedBean.createFilterOptions" style="width:150px" />  
                        </p:outputPanel>  
                    </f:facet>  

                    <p:column style="width:25px">  
                        <p:rowToggler />  
                    </p:column>  

                    <p:column filterBy="#{localizedState.branchName}" headerText="#{bundle['branch.name.label']}" filterMatchMode="contains">  
                        <h:outputText value="#{localizedState.branchName}" />  
                    </p:column>        

                    <p:column filterBy="#{localizedState.branchAddress.postalCode}" headerText="#{bundle['branch.postalcode.label']}" filterMatchMode="contains">  
                        <h:outputText value="#{localizedState.branchAddress.postalCode}" />  
                    </p:column>

                    <p:column filterBy="#{localizedState.branchAddress.streetName}" headerText="#{bundle['branch.streetname.label']}" filterMatchMode="contains">  
                        <h:outputText value="#{localizedState.branchAddress.streetName}" />  
                    </p:column> 


                    <p:column filterBy="#{localizedState.localizedFnbType}" headerText="#{bundle['branch.fnbtype.label']}" filterMatchMode="contains">  
                        <h:outputText value="#{localizedState.localizedFnbType}" />  
                    </p:column> 


                    <p:column style="width:420px">
                        <p:commandButton value="#{bundle['branch.editbranchdetails.title']}" update="statusMessages" actionListener="#{viewBranchManagedBean.view_Edit_Branch(localizedState)}" />
                        <p:commandButton value="#{bundle['branch.deletebranchdetails.title']}" update="statusMessages" actionListener="#{viewBranchManagedBean.view_Delete_Branch(localizedState)}" />
                    </p:column>

                    <p:rowExpansion>  
                        <h:panelGrid id="display" columns="2" cellpadding="4" style="width:500px;" columnClasses="label, value">  
                            <h:outputText style="font-weight: bold" value="#{bundle['branch.contactperson.label']}:" /> 
                            <h:outputText value="#{localizedState.contactPerson}" />
                            <h:outputText style="font-weight: bold" value="#{bundle['branch.contactnumber.label']}:" /> 
                            <h:outputText value="#{localizedState.contactNumber}" />
                            <h:outputText style="font-weight: bold" value="#{bundle['branch.emailaddress.label']}:" /> 
                            <h:outputText value="#{localizedState.emailAddress}" />
                            <h:outputText style="font-weight: bold" value="#{bundle['branch.unitnumber.label']}:" /> 
                            <h:outputText value="#{localizedState.branchAddress.unitNumber}" />
                            <h:outputText style="font-weight: bold" value="#{bundle['branch.blocknumber.label']}:" /> 
                            <h:outputText value="#{localizedState.branchAddress.houseNumber}" />
                            <h:outputText style="font-weight: bold" value="#{bundle['branch.buildingname.label']}:" /> 
                            <h:outputText value="#{localizedState.branchAddress.buildingName}" />
                            <h:outputText style="font-weight: bold" value="#{bundle['branch.halaltype.label']}:" /> 
                            <h:outputText value="#{localizedState.isHalalEnum}" />
                            <h:outputText style="font-weight: bold" value="#{bundle['branch.pricerange.label']}:" /> 
                            <h:outputText value="#{localizedState.priceRangeEnum}" /> 
                        </h:panelGrid>  
                    </p:rowExpansion>  
                </p:dataTable>
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>
